<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
      
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<title>JBoss Suites: Seam Framework</title>
	<link href="css/screen.css" rel="stylesheet" type="text/css" />
</head>
<body id="pgHome">
<f:view>
 <h:outputText value="#{userManage.test}"></h:outputText>
 <rich:tabPanel switchType="client">
  <rich:tab label="Users">
  
        <a4j:form>
            <rich:spacer height="30" />
            <h:panelGrid columns="1" id="mainTable">
            <rich:dataTable rowKeyVar="rkv" value="#{userManage.allUsers}" var="user"
			onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
			onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
                <rich:column id="loginCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Login" /></f:facet>
                    <h:outputText value="#{user.loginName}" />
                </rich:column>
                <rich:column id="passwordCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Password" /></f:facet>
                    <h:outputText value="#{user.password}" />
                </rich:column>
                <rich:column id="firstNameCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="First Name" /></f:facet>
                    <h:outputText value="#{user.firstName}" />
                </rich:column>
                <rich:column id="surnameCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Surname" /></f:facet>
                    <h:outputText value="#{user.surname}" />
                </rich:column>
                <rich:column id="emailCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="E-mail" /></f:facet>
                    <h:outputText value="#{user.email}" />
                </rich:column>
                <rich:column id="balanceCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Balance" /></f:facet>
                    <h:outputText value="#{user.balance}" />
                </rich:column>
 				<rich:column id="birthDateCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Birth Date" /></f:facet>
                    <h:outputText value="#{user.birthDate}" />
                </rich:column>
                <rich:column id="registerDateCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Register Date" /></f:facet>
                    <h:outputText value="#{user.registerDate}" />
                </rich:column>
                <rich:column id="deleteActionCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Delete" /></f:facet>
                    <a4j:commandButton action="#{userManage.removeUser(user)}" reRender="mainTable" value="Delete" />
                </rich:column>
                <rich:column id="blockActionsCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="(Un)Block" /></f:facet>
                    <a4j:commandButton rendered="#{user.isBlocked == false}" action="#{userManage.blockUser(user)}"   reRender="mainTable" value="Block"   />
                    <a4j:commandButton rendered="#{user.isBlocked == true }" action="#{userManage.unblockUser(user)}" reRender="mainTable" value="Unblock" />
                </rich:column>
                
                <rich:column id="detailsCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="User's slips" /></f:facet>
                    <a4j:commandButton action="#{userManage.setDetails(user)}"   reRender="detailsTable" value="Details"   />
                </rich:column>
            </rich:dataTable>
            </h:panelGrid>
            
	        <h:panelGrid columns="1" id="detailsTable">
				<rich:dataTable rowKeyVar="rkv" value="#{userManage.details.bettingSlips}" var="bettingSlip"
				rendered="#{userManage.details != null}"
				onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
				onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
				<rich:column id="betIdCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="ID" /></f:facet>
                    <h:outputText value="#{bettingSlip.id}" />
                </rich:column>
	             <rich:column id="moneyCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Money" /></f:facet>
                    <h:outputText value="#{bettingSlip.money}" />
                </rich:column>
	             <rich:column id="quantityCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="# of bets" /></f:facet>
                    <h:outputText value="#{bettingSlip.bets.size()}" />
                </rich:column>
				</rich:dataTable>
            </h:panelGrid>
        </a4j:form>
  </rich:tab>
  
  
  <rich:tab label="Participants">
  		<a4j:form>
            <rich:spacer height="30" />
            <h:panelGrid columns="1" id="mainTable2">
            <rich:dataTable rowKeyVar="rkv" value="#{participantsManage.allParticipants}" var="participant"
			onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
			onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
                <rich:column id="namePartCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Name" /></f:facet>
                    <h:outputText value="#{participant.name}" />
                </rich:column>
                <rich:column id="descPartCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Description" /></f:facet>
                    <h:outputText value="#{participant.description}" />
                </rich:column>
                <rich:column id="partDelCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Delete" /></f:facet>
                    <a4j:commandButton action="#{participantsManage.removeParticipant(participant)}" reRender="mainTable2" value="Delete" />
                </rich:column>
            </rich:dataTable>
            </h:panelGrid>
        </a4j:form>
  </rich:tab>
  
  
  <rich:tab label="Disciplines">
    		<a4j:form>
            <rich:spacer height="30" />
            <h:panelGrid columns="1" id="mainTable3">
            <rich:dataTable rowKeyVar="rkv" value="#{disciplinesManage.allDisciplines}" var="discipline"
			onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
			onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
                <rich:column id="nameDiscCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Name" /></f:facet>
                    <h:outputText value="#{discipline.name}" />
                </rich:column>
                <rich:column id="descDiscCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Description" /></f:facet>
                    <h:outputText value="#{discipline.description}" />
                </rich:column>
             
                <rich:column id="partDelCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Delete" /></f:facet>
                    <a4j:commandButton action="#{disciplinesManage.removeDiscipline(discipline)}" reRender="mainTable3" value="Delete" />
                </rich:column>
            </rich:dataTable>
            </h:panelGrid>
        </a4j:form>
  </rich:tab>
  
  
  <rich:tab label="Groups">
      		<a4j:form>
            <rich:spacer height="30" />
            <h:panelGrid columns="1" id="mainTable4">
            <rich:dataTable rowKeyVar="rkv" value="#{groupsManage.allGroups}" var="group"
			onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
			onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
                <rich:column id="nameGrpCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Name" /></f:facet>
                    <h:outputText value="#{group.name}" />
                </rich:column>
                <rich:column id="descGrpCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Description" /></f:facet>
                    <h:outputText value="#{group.description}" />
                </rich:column>
             
                <rich:column id="partGrpCol">
                    <f:facet name="header"><h:outputText styleClass="headerText" value="Delete" /></f:facet>
                    <a4j:commandButton action="#{groupsManage.removeGroup(group)}" reRender="mainTable4" value="Delete" />
                </rich:column>
            </rich:dataTable>
            </h:panelGrid>
        </a4j:form>
  </rich:tab>
  
  
  <rich:tab label="Events">
  </rich:tab>
  </rich:tabPanel>
</f:view>
</body>
</html>
